import java.util.Scanner;

public class TestDay40 {

    //发邮件
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int[]d = new int[21];
        d[0] = 0;
        d[1] = 0;
        d[2] = 1;
        for (int i = 3; i <= 20 ; i++) {
            d[i] = (i-1)*(d[i-1]+d[i-2]);
        }
        while (s.hasNext()){
            int n = s.nextInt();
            System.out.println(d[n]);
        }
    }


}
